<?php

itstock_structure($structure, 'vendor');
$edit = false;

if(isset($_POST['id'])){
    $structure['where'][0] = sprintf("`%s`.`id`='%s'", $structure['table'], itstock_decode($_POST['id']));
    $edit = itstock_search_all($structure);
}

?><b><?php echo (!$edit?'New ':'')?>Vendor</b>
  <br><br><br>
<form class="save" action="store.php?type=vendor" method="POST" id="form_vendor" autocomplete="off">
  <input type="hidden" value="<?php echo ($edit?itstock_encode($structure['data'][0]['id']):'')?>" id="id" name="id">
  <table>
    <tr>
      <td><label>Vendor:</label></td>
      <td><input type="text" autofocus name="vendor" style="width: 200px" value="<?php echo ($edit?$structure['data'][0]['vendor']:'')?>" required placeholder="Vendor"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><br><input type="submit" value="Save" style="margin-right: 100px;"><input type="reset" value="Reset"></td>
    </tr>
  </table>
</form>
